home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / pcpil / pidoc4.txt < prev    next >
Text File  |  1994-02-28  |  38KB  |  1,050 lines

  1. Chapter 3. OPERATORS AND EXPRESSIONS
  2.  
  3. PILOT accepts expressions in many contexts.  An expression is a combination 
  4. of variables, numeric constants, string constants, functions and operators.  
  5. Expressions are formed in the normal manner allowed by other programming 
  6. languages.  Operator precedence is similar to that of basic.  Parentheses may 
  7. be used to group subexpressions.  
  8.  
  9. EXAMPLE: simple expressions
  10.  
  11.        X + 5
  12.        SIN(I)
  13.        2.5
  14.        (A + B) <= (C + D)
  15.  
  16.  
  17. DATA TYPES
  18.  
  19. Each element of an expression is a number or a string value.  Numbers are 
  20. stored in floating point form with an accuracy of about 6 decimal digits.  
  21. Strings are stored in variable length form with a terminating null character.  
  22.  
  23. Each operator or function expects to act on a particular type of argument, 
  24. and in return produces a particular type of result.  For example, + expects 
  25. two numeric arguments and it produces a numeric result. A unique and 
  26. convenient feature of PILOT is auto-type conversion.  This means that any 
  27. time an argument is of the wrong type (string or number) it is automatically 
  28. converted to the correct type for the context.  A number is converted to a 
  29. string in a manner like that of the STR function, which puts the value in 
  30. printable format with decimal places only if necessary.  A string is 
  31. converted to a number in a manner like that of the FLO function, which scans 
  32. the string for the first number value or returns zero if no number is found.  
  33. VARIABLES 
  34.  
  35. A variable name can be up to length six.   The first character must be a 
  36. letter.  Other characters may be letters or digits.  The last character may 
  37. be a $ to signify a string variable.  Upper and lower case letters are 
  38. considered to be equal when naming a variable (i.e. - XYZ and xyz name the 
  39. same variable).  A string variable must be dimensioned in a D: statement 
  40. before it can be used to store a string value.  
  41.  
  42. EXAMPLE: variables
  43.  
  44.       X  COUNT  J5  able  NAME$ 
  45.  
  46. SYSTEM VARIABLES
  47.  
  48. There are several system variables which can be used in the same context as 
  49. other variables.  
  50.  
  51. %A - answer counter
  52.  
  53. %A is a numeric variable equal to the number of times the last A: has 
  54. executed without any other intervening A:. It tells how many attempts the 
  55. student has made on this question.  
  56.  
  57. %B - answer buffer
  58.  
  59. %B is a string variable which is set to the response given by the student on 
  60. each A:. %B has a maximum length of 80 characters. It can be subscripted like 
  61. any string variable.  
  62.  
  63. %E - return point of last U:
  64.  
  65. %E is a numeric variable which returns the jump value of the return point of 
  66. the most recent USE statement. It is the location which would be returned to 
  67. via an END statement.  
  68.  
  69. %N %M %L - match result variables 
  70.  
  71. These are parsing variables which return information about the last MATCH. 
  72. See the MATCH statement for more details.  
  73.  
  74. See also:  COMPUTE, DIMENSION, SUBSCRIPTING
  75.  
  76. SUBSCRIPTING
  77.  
  78.        array  (position)
  79.        strng$ (position)
  80.        strng$ (position, length)
  81.  
  82. SUBSCRIPTS are used to select an individual value out of a numeric array or a 
  83. substring out of a string variable.  Subscripts consist of a position and 
  84. possibly a length, enclosed in parentheses after a variable name. The 
  85. position and length values can be expressions. Before subscripts can be used 
  86. the variable must have been dimensioned.  See the DIMENSION statement for 
  87. more information.  
  88.  
  89. NUMERIC ARRAY SUBSCRIPTING
  90.  
  91. Numeric arrays start at subscript zero and end at the dimensioned size.  An 
  92. attempt to subscript beyond the array limit results in an error message. A 
  93. reference to an array name without subscripts results in a reference to item 
  94. number zero of the array.  
  95.  
  96. EXAMPLE 1: array subscripts
  97.  
  98.        C: A(3) = X
  99.        C: A(I) = A(I) + 1
  100.        C: LIST(J) = A * 5
  101.  
  102. STRING SUBSCRIPTING
  103.  
  104. String subscripts start at one. If you specify a starting position less than 
  105. one, PILOT will assume you meant one. If you omit the length, a length of one 
  106. is assumed. The portion of a string picked out by subscripts is sometimes 
  107. called a substring.  
  108.  
  109.  
  110. EXAMPLE 2: simple string subscripts
  111.  
  112.        D: X$(20), Y$(10)
  113.        C: X$ = "ABCDEFGHIJKLMNOP"
  114.        C: Y$ = X$(3)
  115.                           Y$ is now equal to "C"
  116.        C: Y$ = X$(5,4)
  117.                           Y$ is now equal to "EFGH"
  118.   
  119. You can assign a value into a substring by placing the subscripted string 
  120. variable on the left hand side of a COMPUTE statement. In this case, only the 
  121. characters within the substring are modified. All other characters within the 
  122. string are unchanged.  
  123.  
  124. EXAMPLE 3: assignment to a substring
  125.  
  126.        D: X$(20)
  127.        C: X$ = "ABCDEFGH"
  128.        C: X$(3) = "s"
  129.                           X$ is now equal to "ABsDEFGH"
  130.        C: X$(4,3) = "12345"
  131.                           X$ is now equal to "ABs123GH"
  132.        C: X$(4,3) = "xy"
  133.                           X$ is now equal to "ABsxy GH"
  134.  
  135. Since a string variable can contain a variable number of characters at any 
  136. one time, it is possible that its current length is less than its maximum 
  137. length as set up by the DIMENSION statement.  
  138.  
  139. If, when a subscripted string is not the target of a COMPUTE statement, the 
  140. start subscript is over the end of the current string length, the returned 
  141. value is a null string. If the start subscript is within the string but the 
  142. length would run over the string length then only the remaining characters 
  143. are returned.  
  144.  
  145.  
  146. EXAMPLE 4: padding a string to its max length
  147.  
  148.        D: X$(100)
  149.        C: X$(100) = " "
  150.                           X$ is now equal to 100 spaces
  151.     
  152.  
  153. You can access a substring of any length you wish. If you leave off the 
  154. length, then the substring is assumed to be length 1. If you give a length 
  155. that would go past the current end of the string, then the substring goes 
  156. from the starting position you specified to the current end of the string. So 
  157. by using a large length value you can reference a substring starting at a 
  158. given position and containing the rest of the string. This is similar to the 
  159. RIGHT function in some languages.  
  160.  
  161. EXAMPLE 5: the rest of the string 
  162.  
  163.        C: X$ = "ABCDEFGHIJ"
  164.        C: Y$ = X$(3,20)
  165.                           Y$ is now equal to "CDEFGHIJ"
  166.  
  167. See also:  DIMENSION, VARIABLES
  168.  
  169. NUMERIC CONSTANTS
  170.  
  171.        [-]digits
  172.        [-]digits.digits
  173.  
  174. A numeric constant consists of an optional leading minus sign, a string of 
  175. decimal digits optionally including a decimal point. Numbers are retained to 
  176. about six digits of accuracy.  
  177.  
  178. EXAMPLE: numeric constants
  179.  
  180.        5
  181.        63.789
  182.        -42.1
  183.  
  184. STRING CONSTANTS
  185.  
  186.        "text"
  187.  
  188. A string constant, or literal, consists of zero or more characters enclosed 
  189. in quotes.  
  190.  
  191. EXAMPLE:
  192.  
  193.        A$="BANANA"
  194.        T(X$ < "A"): NO SIR.
  195.  
  196. OPERATORS
  197.  
  198.  
  199. ARITHMETIC
  200.  
  201.        x + y       x - y       x * y       x / y
  202.        x % y  (remainder of x/y)        -x
  203.  
  204. To compute A to the B power use EXP(B*LNE(A)) 
  205.  
  206.  
  207. RELATIONAL
  208.  
  209.        x < y     x > y     x = y     x <> y
  210.        x <= y    x >= y
  211.  
  212. Comparison is numeric if x is a number or string if x is a string.  For 
  213. string comparisons the shorter string is padded on the right with spaces for 
  214. comparison purposes.  Relational operators always yield a one for true or a 
  215. zero for false.  
  216.  
  217.  
  218. LOGICAL
  219.  
  220.        x & y         (true if both x and y are non-zero)
  221.        x ! y          (true if either x or y is non-zero)
  222.        ^x or ~x     (true if x is zero)
  223.  
  224. Logical operators always produce a 1 for true or a zero for false.  
  225.  
  226.  
  227. STRING
  228.  
  229.        x$ !! y$       (concatenation)
  230.  
  231. Concatenation produces a string consisting of the string value of y$ appended 
  232. to the right end of the string value of x$.  FUNCTIONS 
  233.  
  234.  
  235. A built-in function can be used in an expression to return a pre-defined 
  236. computation or value.  The function name is always followed by parentheses 
  237. containing one or more function arguments. The function arguments may be 
  238. expressions.  
  239.  
  240. ABS(X) - the positive value of X ABS(9) is 9, ABS(-9) is 9 
  241.  
  242. ASC(X$) - the numeric value 0-255 of char X$, ASC("A")=65 
  243.  
  244. ATN(X) - arctangent in degrees of X, ATN(1) is 45 
  245.  
  246. AUX(0) - reads the com1: (rs232) port
  247.  
  248. Returns CHR(0) if no byte ready to read, or a character from CHR(1) to 
  249. CHR(255).The com1: port must be set up via a DOS MODE command before entering 
  250. PILOT.  
  251.  
  252. CAP(X$) - the upper case value of string X$
  253.  
  254. CAP("X2 is it.") is "X2 IS IT". 
  255.  
  256. COS(X) - cosine of X degrees, COS(60) is .5
  257.  
  258. CHR(X) - the Xth ascii character, CHR(65) is A 
  259.  
  260. CLK(n) - time and date clock
  261.  
  262. n=0 gives the time of day in seconds, n=1 gives year; n=2 gives month; n=3 
  263. gives day 
  264.  
  265. DEC(X,n) - string value of number X with n decimal places 
  266.  
  267. DEC(13.45095,2) is 13.45 
  268.  
  269. EXP(X) - e to the X power,  EXP(3.5) is 33.11 ...
  270.  
  271. FIZ(X$) - size of a file
  272.  
  273. X$ MUST BE a string variable, NOT an expression. The variable contains a path 
  274. or file name. The return value is the length, in bytes, of the file, or -1 if 
  275. the  file does not exist.  
  276.  
  277. FLO(X$) - convert a string to a real number
  278.  
  279. The numeric value of the first number found in string X$, FLO("Either 12 or 
  280. 14") is 12. 
  281.  
  282. INS(X$) - search for a character in %b
  283.  
  284. Returns zero if character X$ is not in %B, otherwise the first 
  285. position in %B where X$ is found. 
  286.  
  287. INP(X) - machine level IN instruction
  288.  
  289. Returns a byte from io port X. 
  290.  
  291. INT(X) - value of X truncated to an integer, INT(13.89) is 13 
  292.  
  293. KEY(X) - return keyboard status
  294.  
  295. Returns zero if no key is pressed,  otherwise the ascii code for the 
  296. depressed key.  If X=0, then the character is read from the type-ahead 
  297. buffer.  If X=1, then the character is left in the type ahead buffer.  
  298.  
  299. LEN(X$) - current length of string X$, LEN("abc") is 3 
  300.  
  301. LNE(X) - natural log (base e) of X, LNE(10) is 2.302 ...
  302.  
  303. LOG(X) - log base 10 of X, LOG(10) is 1.00
  304.  
  305. MEM(0) - number of unused bytes for strings and arrays 
  306.  
  307. MOD(0) - returns the current screen mode 
  308.  
  309. OFF(X$) - memory offset address
  310.  
  311. Returns the offset part of the address of the string variable. 
  312.  
  313. PEK(X) - read memory byte
  314.  
  315. Returns a value from 0 to 255 equal to the byte in memory at offset X in the 
  316. segment whose base is in the variable %A.  RND(X) - random number generator 
  317.  
  318. If X is zero, returns a random   fraction from 0 to 1. If X>0, returns a 
  319. random integer from 0 to X-1. If X=-1, a fixed sequence of random numbers is 
  320. used for all subsequent uses of RND and SFL.  
  321.  
  322. RSP(X$) - the string value of X$ with all spaces removed, 
  323.  
  324. RSP("That is all") is "Thatisall".
  325.  
  326. SEG(X$) - memory segment address
  327.  
  328. Returns the segment part of the address of the string variable.  
  329.  
  330. SFL(X$) - shuffled version of the characters in string X$, 
  331.  
  332. SFL("abcde") might be "bcade".
  333.  
  334. SGN(X) - -1 if X is negative, 0 if X is 0, +1 if X is positive 
  335.  
  336. SIN(X) - sine of X degrees, SIN(30) is .5
  337.  
  338. SPC(n) - gives n spaces
  339.  
  340. SQR(X) - square root of X, SQR(9) is 3
  341.  
  342. STR(X) - the string value of number X
  343.  
  344. SWP("xy") - swap characters
  345.  
  346. Returns a string equal to the value of %B except that each character x is 
  347. changed to character y; if %B holds "Why not exit?", SWP("xy") is Why not 
  348. eyit?  
  349.  
  350. TIM(0) - response time in seconds of last A:
  351.  
  352. TSP(X$) - string value of X$ with trailing spaces removed 
  353.  
  354. WRD(X$,n) - gives the nth word in the string X$ 
  355.  
  356. WRD("one two three four",2) returns "two" 
  357.  
  358. XCR(0) - x position of the text cursor
  359.  
  360. XPX(0) - x position of the graphic turtle
  361.  
  362. YCR(0) - y position of the text cursor
  363.  
  364. YPX(0) - y position of the graphic turtle
  365.  
  366. EXAMPLE 1: use AUX to read N characters from serial port 
  367.  
  368.        D:X$(80)
  369.        C:X$ = ""
  370.        C:N=10
  371.        *LOOP  C:X$= X$ !! AUX(0)
  372.        J(LEN(X$)<N):LOOP
  373.  
  374. EXAMPLE 2: use CLK to print date and time of day 
  375.  
  376.        C: T = CLK(0)
  377.        C: HH = INT(T/3600)
  378.        C: MM = INT((T-3600*HH)/60)
  379.        C: SS = INT(T-HH*3600 - MM*60)
  380.        C: YY = CLK(1) ; MO = CLK(2) ; DD = CLK(3)
  381.        T: #YY/#MO/#DD   #HH:#MM:#SS
  382.  
  383. EXAMPLE 3: use SFL to randomize a list of 10 questions 
  384.  
  385.        D: X$(10)
  386.        C: X$ = "ABCDEFGHIJ"
  387.        C: X$ = SFL(X$)
  388.        C: N=0
  389.        R: each problem ends by a JUMP to LOOP
  390.        *LOOP
  391.        C: N=N+1
  392.        J(N>10):DONE
  393.        X: "J:QUES" !! X$(N)
  394.        . . .
  395.        *QUESA . . .
  396.        . . .
  397.        J:LOOP
  398.  
  399.  
  400. Chapter 4. GOTO AND ESCAPE COMMANDS
  401.  
  402. GOTO COMMAND
  403.  
  404. The GOTO command can be enabled or disabled by an option on the PROBLEM 
  405. statement. If enabled, then each ACCEPT statement automatically checks the 
  406. student response for the command: 
  407.  
  408.        GOTO destination
  409.  
  410. If present, a JUMP to the destination is immediately performed. The 
  411. destination can be any of those available on the JUMP statement.  This 
  412. feature is extremely useful when writing or debugging a long program. You can 
  413. enable the GOTO option, then when testing, you can jump around in the program 
  414. to test the relevant section. Once the program is debugged, you can disable 
  415. the GOTO command.  
  416.  
  417. You could conceivably allow the student to use GOTO to navigate within a 
  418. program, however, there is a better way to give the student the branching 
  419. control needed.  
  420.  
  421.  
  422. ESCAPE COMMAND
  423.  
  424. The ESCAPE command can be enabled or disabled by two options on the PROBLEM 
  425. statement, the E option enables the ESCAPE key, and the F option enables the 
  426. FUNCTION and CURSOR keys. You can choose to have either, both or neither 
  427. option enabled. The enabled keys become "HOT KEYS" that cause an immediate 
  428. action to take place if the student presses the key while responding to an 
  429. ACCEPT. If one of the (enabled) hot keys is detected the automatic action is 
  430. equivalent to: 
  431.  
  432.        U: SYSX
  433.  
  434. That is, the subroutine named *SYSX is called.  It is up to you to insure 
  435. that the label *SYSX is present in the program module and that it contains 
  436. the code to perform the desired special action.  
  437.  
  438. The SYSX routine can be used to record comments from the student as shown in 
  439. the first example below.  It can also be used to allow the display of a menu 
  440. or glossary on demand.  The SYSX routine should end with an END statement.  
  441. If no argument is given on the END then a return is made to the statement 
  442. after the ACCEPT.  The first example below returns to re-execute the ACCEPT.  
  443. Note also that since the END can specify a label, it is not necessary to 
  444. return at all, as shown in the second example.  
  445.  
  446.  
  447. EXAMPLE 1: SYSX used to record student comments. If the student enters a 
  448. comment, then the ESCAPE key, the comment is written to the KEEP file.  
  449.  
  450.        *SYSX  K:%B
  451.        E:@A
  452.  
  453. EXAMPLE 2: SYSX used to return to a main menu 
  454.  
  455.        *SYSX  T: GOING TO MAIN MENU.
  456.        E:MENU
  457.  
  458. EXAMPLE 3: SYSX used to display a help page, then return to allow the student 
  459. to answer again.  
  460.  
  461.        *SYSX
  462.        GSX:                            (save screen image)
  463.        U:HELP                        (go display the help)
  464.        T:Push a key to go on.
  465.        W:30000                       (pause while he reads)
  466.        GX:                             (put the screen back)
  467.        E:@A                           (return to ACCEPT)
  468.  
  469. ANSWER BUFFER DURING AN ESCAPE
  470.  
  471. When the SYSX routine is reached, the last character in the answer buffer, 
  472. %B, is the character that caused the escape function to take place. If the 
  473. student had entered any data prior to pushing the hot key, then that data is 
  474. also in %B, as usual. This example shows how to separate the last character 
  475. from %B.  
  476.  
  477. EXAMPLE 4: SYSX used detect which hot key used
  478.  
  479.        *SYSX
  480.        C: L = LEN(%B)                        (length of %B)
  481.        C: K = ASC(%B(L))                   (K is hot key value)
  482.        C(L>1): %B = %B(1,L-1)           (remove last char)
  483.       
  484.  
  485. CHANGING THE ESCAPE KEYS
  486.  
  487. The P:E option enables the ESC key. It generates ASCII code 27. If you wish 
  488. to use another key for this purpose use the NX: statement to change which key 
  489. generates code 27.  
  490.  
  491. Similarly, P:F enables codes 187 through 221.  These are the codes normally 
  492. generated by the function keys, the shifted function keys, and the keys in 
  493. the cursor control pad area. You could re-assign various keys in and out of 
  494. this range to control which keys are hot keys.  
  495.  
  496. COMPATIBILITY
  497.  
  498. For compatibility with other versions of PILOT.  The P:E option also enables 
  499. the escape to *SYSX if the first character of a student reply is the "@" 
  500. character. This check takes place only after the student has pushed the ENTER 
  501. key to end the response.  
  502.  
  503. See also:  PROBLEM, ACCEPT, USE, END   
  504.  
  505. Chapter 5. ERROR MESSAGES
  506.  
  507. PILOT is programming-error tolerant. If an error is detected, the statement 
  508. in error is displayed. Before it is a message which identifies the problem.  
  509. Execution then pauses.  The user can push ctrl-c to stop the program or push 
  510. any other key to ignore the error and continue execution with the next 
  511. statement.  If it is at all possible to go on, and it usually is, PILOT will 
  512. continue with the program.  The following error codes are used by PILOT.  
  513. Error messages can be suppressed by setting the I option on the PROBLEM 
  514. statement.  
  515.  
  516. disk - i/o error in program file 
  517.  
  518. This usually means that the diskette has unreadable data on it.  
  519.       
  520. exp - invalid or missing expression 
  521.  
  522. This error can signify any number of syntax errors in the construction of a 
  523. PILOT statement. Usually it means that you have used operators or functions 
  524. improperly.  
  525.  
  526. file - no file open or disk i/o error 
  527.  
  528. This error can mean that a diskette is write-protected, full, or the 
  529. directory is full. It can also mean that the FILES=n parameter in your 
  530. CONFIG.SYS file specifies too few files for your system. Try placing  
  531. FILES=16  in your file CONFIG.SYS. 
  532.  
  533. label - missing destination 
  534.  
  535. A syntax error in specifying a jump label.  
  536.  
  537. link - program file not found (program stops) 
  538.  
  539. You linked to a file or path name that could not be found.  
  540.  
  541. lspace - too many labels in one program module 
  542.  
  543. One program module can contain 200 labels. Break the module into several 
  544. smaller ones.  mode - graphics done when not in mode 4, 5 or 6. The hardware 
  545. will not do graphics in a text mode.  
  546.  
  547. open - can not open disk file 
  548.  
  549. Disk drive not ready, write protected, or full. See also "file" above 
  550.  
  551. opcode - invalid op code or modifiers 
  552.  
  553. PILOT does not recognize what comes before the colon as a legal statement.  
  554.  
  555. paren - missing parenthesis
  556.  
  557. quote - missing closing quote
  558.  
  559. sprite - illegal sprite syntax 
  560.  
  561. Attempt to use a string less than 2218 bytes as a sprite table, or invalid 
  562. sprite usage.  
  563.  
  564. sspace - memory overflow
  565.  
  566. Not enough string and array space left to do string operations.  
  567.  
  568. subscript - too  big for the array 
  569.  
  570. syntax - statement has bad command or operator
  571.  
  572. uspace - use call level is too deep ( over 32 )
  573.  
  574. var - missing variable name
  575.  
  576. vspace - over 200 variables in use
  577.  
  578. xspace - no more memory for arrays or strings
  579.  
  580.  
  581. Chapter 6. DISTRIBUTING PROGRAMS
  582.  
  583. If you develop a program using PILOT and wish to provide that program to 
  584. others who may not have PILOT, you can do so by following these procedures.  
  585.  
  586. First, develop and test your program in the normal way.  Next, use the PCRYPT 
  587. program to translate your lesson files into a binary format which is not 
  588. human-readable.  To do this type 
  589.  
  590.        PCRYPT  name  n
  591.  
  592. n is a number which represents the maximum program length in 8KB increments. 
  593. If n is omitted, PCRYPT defaults to a value of 4 (32 KB).  This command reads 
  594. your program from file name.PIL and produces a file named name.PIX.  It is 
  595. impossible to go backwards from a PIX file to a PIL file, so be sure to keep 
  596. the original.  If your lesson uses LINK statements you must use PCRYPT to 
  597. translate all applicable lesson files. The following command can be used to 
  598. encrypt all PIL files in the current disk or directory: 
  599.  
  600.        PCRYPT  *  n  
  601.  
  602. To run the encrypted (.PIX) version of a program use: 
  603.  
  604.        CPI  name  n
  605.  
  606. To distribute your program provide the PIX files and the file CPI.EXE to the 
  607. user.  The user can run the program but can neither read nor modify your 
  608. source code. 
  609.  
  610. Do not duplicate or distribute copies of any other files provided with the 
  611. PILOT system.  
  612.  
  613.  
  614. Chapter 7. EZ EDITOR
  615.                                                             
  616. EZ is a full screen text editor.  You can use it to create and edit your 
  617. PILOT programs. To use it enter: 
  618.  
  619.        EZ  name.PIL
  620.                    
  621. where name.PIL is the file name you wish to create or modify.  If the file 
  622. does not exist, it is created.  If it does exist, it is read into memory and 
  623. displayed on the screen.  When you finish with EZ, a backup copy of the file 
  624. is retained as name.BAK. You always have two copies of your program file: 
  625. name.PIL is the current copy and name.BAK is the file just prior to the last 
  626. time you edited the file. The EZ command and file name may be preceded by 
  627. optional drive or path designations per normal DOS conventions. The maximum 
  628. size text file supported by EZ is 50,000 bytes.  
  629.  
  630.  
  631. EZ FUNCTION KEYS
  632.  
  633. Once in EZ, the screen is a window on the text file.  The various cursor and 
  634. function keys are used to move around in the text and to add, change or 
  635. delete text.  When adding or replacing text, you just type on the keyboard; 
  636. what you see on the screen is what you get in the text file.  The following 
  637. summary shows the various keyboard functions you can use. The F9 key may be 
  638. used at any time to display an on-line help menu which summarizes these 
  639. functions.  
  640.  
  641.  
  642. Arrows - move the cursor one space in any direction  
  643.  
  644. TAB - skip to next tab stop. Tab stops are each 10 columns  
  645.  
  646. HOME - move to the first text line of the file  
  647.  
  648. END - move to the last text line of the file  
  649.  
  650. PG UP - move up (backwards) one screen  
  651.  
  652. PG DN - move down (forward) one screen  
  653. INS - insert a space into the line  
  654.  
  655. DEL - remove the current character  
  656.  
  657. F1 - insert line
  658.  
  659. When in column 1: Insert a blank line.  When not in column 1: Split line into 
  660. two lines.  
  661.  
  662. F2 - delete line
  663.  
  664. When in column 1: Remove the current line and place it on the PICK STACK.  
  665. When at end of a line: join the next line to the current line.  
  666.  
  667. F3 - copy the current line onto the PICK STACK  
  668.  
  669. F4 - insert top line off the PICK STACK before current line  
  670.  
  671. F5 - search string, or goto a line number,  see below   
  672.  
  673. shift F5 - replace search string, see below  
  674.  
  675. F6 - shift to extended character set for next key pressed  
  676.  
  677. shift F6 - shift lock to extended character set
  678.  
  679. Shift until F6 pushed again or the ENTER key is pushed.  This enables  the 
  680. insertion of characters from 128-255 into a program file.  See appendix B for 
  681. available characters.  
  682.  
  683. F7 - expand a MACRO into the text  
  684.  
  685. shift F7 - insert a file into the text
  686.  
  687. Enter the name of a file to be copied into the current file and inserted 
  688. prior to the current line.  
  689.  
  690. F8 - switches to/from graphics mode 
  691.  
  692. In graphics mode characters defined by N: statements in this program  file 
  693. are displayed.  User can enter name of another PILOT file which has further 
  694. N: statements to be executed.  
  695.  
  696. shift F8 - enter character editor (only in graphics mode)
  697.  
  698. F9 - on-line HELP key  
  699.  
  700. shift F9 - write or print all or part of text
  701.  
  702. Write all or a part of the text to a disk file or to the printer. To send the 
  703. text to the system printer enter PRN: as the file name.  
  704.  
  705. To start the write at a line other than the first line of the file, place a 
  706. line containing only [[[[ prior to the first line to be written. To stop 
  707. writing prior to the end of the file place a line containing only ]]]] after 
  708. the last line to be written.    
  709.  
  710. F10 - save file and exit to DOS  
  711.  
  712. shift-F10 - abandon edited file, exit to DOS without saving
  713.  
  714. USING THE PICK STACK IN EZ
  715.  
  716. The PICK STACK is an invisible last-in/first-out buffer which can store up to 
  717. 16 lines of text at a time.  It has three uses.  
  718.  
  719. First, if you accidentally delete some lines using F2, they can be put back 
  720. again by pushing F4.  
  721.  
  722. Second, to move lines push F2 once per line to delete them, then move to the 
  723. desired location and push F4 once per line to re-insert them in the new 
  724. place.  
  725.  
  726. Third, to duplicate lines push F3 once per line to copy them onto the PICK 
  727. STACK, then move to the new location and push F4 once per line to insert them 
  728. in the new place.  
  729.  
  730. SEARCH AND REPLACE
  731.  
  732. To search for a line number push F5 then press the "@" key, the line number, 
  733. and ENTER.  
  734.  
  735. To search for a string push F5 then type the string and push ENTER. To find 
  736. the same string again just push F5 then ENTER, you do not need to type the 
  737. search string again if it is the same as the last search.  
  738.  
  739. To search for a string and replace it with another string: push F5, then type 
  740. the search string (but don't push ENTER yet). Next push shift-F5, then type 
  741. the replacement string and push ENTER. EZ will find and display the next 
  742. occurrence of the search string.  At that time push shift-F5 to replace the 
  743. string, or just push F5 to find the next occurrence. By using F5 and shift-F5 
  744. alternately you can see each occurrence of the search string to decide 
  745. whether it should be replaced.  
  746.  
  747. To find each successive occurrence of the search string and immediately 
  748. replace it with the replacement string, just push shift-F5.  repeatedly, once 
  749. for each time you wish to search and replace.  
  750.  
  751. MACROS IN EZ
  752.  
  753. The F7 key is used to read and expand a macro into the text. A macro is a 
  754. pre-programmed sequence of instructions which can be accessed as a whole to 
  755. reduce your programming time. To include a macro push F7 then type the name 
  756. of the macro file and push ENTER. The macro may prompt for information on the 
  757. bottom two lines of the screen prior to completing the macro expansion. More 
  758. information on macros can be found below. See "How to Write a Macro for EZ".  
  759.  
  760. EXTENDED CHARACTERS IN EZ
  761.  
  762. The extended characters, from ASCII 128 to 255, do not have keys on the 
  763. keyboard. By using the F6 key you can enter these extended characters.  To 
  764. enter one, push F6, then another key. A value of 128 is added to the normal 
  765. value of the key, which produces a character in the extended range. Appendix 
  766. A contains a list of the numeric values for the various keyboard 
  767. combinations.  The character editor, described below, can also be used to 
  768. determine the key combination for any particular extended character.  
  769.  
  770. When EZ is entered, the screen is in text mode.  In this mode you see the 
  771. text mode extended characters for codes 128 to 255. These are the characters 
  772. built-in to the hardware which would appear in a PILOT program for text modes 
  773. (0-3).  
  774.  
  775. The F8 key switches EZ to graphics mode. In this mode you see the user-
  776. defined characters for codes 128 to 255.  
  777.  
  778. The PILOT N: statement allows you to redefine character patterns to be 
  779. displayed when the PILOT program in executed. The F8 key allows you to see 
  780. the re-defined characters while editing your program with EZ.  
  781.  
  782. When F8 is pushed, all N: statements in the file are executed, just as they 
  783. will be executed when the PILOT program is run. Also, you are prompted for 
  784. the name of another file which contains N: statements you wish to  execute. 
  785. This allows you to see re-defined characters even if the character 
  786. definitions are in a file other than the one in which you are editing.  When 
  787. entering the file name, you must enter the entire name (eg. PART7.PIL). If 
  788. you do not wish to enter another file name, just push ENTER.  
  789.  
  790. CHARACTER EDITOR
  791.  
  792. To simplify the task of creating your own special characters EZ contains the 
  793. Character Editor.  
  794.  
  795. Special characters should not be confused with character "fonts". Special 
  796. characters are limited to the standard 8 by 8 pixel character grid. Character 
  797. fonts are used to display characters of smaller or larger proportions. 
  798. Creation of fonts is documented in the section entitled "Font Editor".  
  799.  
  800. To enter the character editor hold SHIFT and push F8.  The character editor 
  801. is available only after you have used the F8 key to switch EZ from text to 
  802. graphics mode. With the character editor you can: 
  803.  
  804. 1) See the 128 character patterns which makes up the extended character set.  
  805.  
  806. 2) Look up the key combination needed to enter any particular extended 
  807. character into your program file.  
  808.  
  809. 3) Modify one or more extended character patterns.  
  810.  
  811. 4) Create new extended characters.  
  812.  
  813. In PILOT you re-define a character grid by specifying 64 dots and slash 
  814. characters on a NEW CHARACTER statement. The character editor lets you see 
  815. the character grid in a normal size and in a blown-up size, so that you can 
  816. see and change each dot individually. When you are done editing a character 
  817. with the character editor, the character editor creates the appropriate NEW 
  818. CHARACTER statement and inserts it into your program text for you.  
  819.  
  820. Once you enter the character editor, the on-screen help menus provide all the 
  821. information you need in order to use it effectively.  
  822.  
  823. CHARACTER EDITOR MODES
  824.  
  825. The character editor has two operating modes: GRID MODE and SELECT MODE. In 
  826. GRID MODE you can edit the dot pattern for a selected character.  In SELECT 
  827. MODE you can pick out which character you wish to work on.  To enter the 
  828. character editor in GRID MODE, push the SHIFT-F8 when the cursor is on an N: 
  829. statement. The character represented on the N: statement is automatically 
  830. selected for editing.  
  831.  
  832. To enter the character editor in SELECT mode push the 
  833. SHIFT-F8 when the cursor is not on an N: statement.  
  834.  
  835. In either mode you see the entire 128 characters displayed in the upper right 
  836. part of the screen.  The characters are displayed as they are currently 
  837. defined by the N: statements in the current file and those in any extra file 
  838. you named when you pushed F8 to enter graphics mode.  
  839.  
  840. To the left you see the currently selected character in a blown-up form and 
  841. in normal size displayed in colors 1, 2 and 3. Also shown is the key 
  842. combination you use after F6 to enter this character into your text file and 
  843. the numeric value of the character, from 128 to 255.  
  844.  
  845. If you are using extended characters the SELECT MODE is an easy way to look 
  846. up the keys you should press to enter any extended character into your text. 
  847. To do this push SHIFT-F8, position the cursor to the desired character, note 
  848. the F6 key combination shown, then push F10 to go back to text editing mode.  
  849.  
  850. SELECT MODE
  851.  
  852. In SELECT MODE you can use the arrow keys to select the desired character. 
  853. Then push F9, to go to GRID MODE, to edit the character or push F10 to return 
  854. to text editing mode.  
  855.  
  856. In SELECT MODE you can copy one character pattern to another as follows: 
  857. First move to the character to be copied, push F3 to pick up the character, 
  858. then move to the destination character and push F4 to copy it.  Notice that 
  859. to the left of the character table is the character you have currently picked 
  860. up.  
  861.  
  862. GRID MODE
  863.  
  864. In GRID MODE you use the arrow keys to move the cursor around within the 
  865. blown-up character cell. You can use the various function keys to modify the 
  866. character pattern as you wish.  Note that the starting grid is saved in the 
  867. "picked up" character spot. If you accidentally destroy the character grid as 
  868. you edit, you can put it back by pushing F4. You can pick up the current grid 
  869. at any time by pushing F3 again.  
  870.  
  871. Once you have finished with the character, you can push either F9 or F10. In 
  872. either case, the character editor changes or inserts the appropriate N: 
  873. statement in your text file. If you push F9, then you are moved to SELECT 
  874. MODE to select another character for editing. If you push F10 you are 
  875. returned to text edit mode.  
  876.  
  877. GRID MODE FUNCTION KEYS
  878.  
  879. Arrows - move cursor 1 space in any direction (if stream mode is on, then set 
  880. or clear the dot) 
  881.  
  882. F1 - turn dot on and turn off stream modes  
  883.  
  884. F2 - turn dot off and turn off stream modes  
  885.  
  886. shift F1 - toggle stream set mode  
  887.  
  888. shift F2 - toggle stream clear mode 
  889.  
  890. F3 - pick up grid and save it  
  891.  
  892. F4 - restore grid to last picked up value  
  893.  
  894. F5 - invert all dots in the grid  
  895.  
  896. shift F5 - clear grid (turn all dots off)  
  897.  
  898. F6 - rotate grid clockwise 90 degrees  
  899.  
  900. shift F6 - reflect grid across a vertical center  
  901.  
  902. F7 - roll grid one bit to the left  
  903.  
  904. F8 - roll grid one bit up  
  905.  
  906. F9 - save N: statement and goto SELECT mode  
  907.  
  908. F10 - save N: statement and goto text editor  
  909.  
  910. HOW TO WRITE A MACRO FOR EZ
  911.  
  912. The user of EZ can call upon pre-made code sequences which are included in 
  913. the user program by use of the F7 function key. A pre-made code sequence is 
  914. called a MACRO and is stored as a text file. By convention, PILOT language 
  915. macros are named with a file suffix of ".PIM". Usually a macro is used to 
  916. include the code in a program to perform some well-defined task. Such a task 
  917. might be to display a menu, ask a multiple choice question, or update a 
  918. student score record.  
  919.  
  920. The program author can save much time by using a macro rather than taking the 
  921. time to write a commonly used code sequence over and over. Often the macro 
  922. has been written ahead of time by another party, but the author might create 
  923. personally useful macros also.  
  924.  
  925. The following code could be stored in a file ANIMATE.PIM and used to move the 
  926. word "Hello" across the screen.  
  927.  
  928.        TS:G10,10
  929.        TS:*20(A Hello;D3;Wr)
  930.  
  931. To use it the author would push F7, type the name ANIMATE.PIM, and the above 
  932. two lines would be copied into the current program file.  
  933.  
  934. SYMBOLIC PARAMETERS IN A MACRO 
  935.  
  936. Very often the desired code sequence needs to be expanded in slightly 
  937. different ways depending on the exact needs of the program. For this reason a 
  938. macro can be written such that symbolic parameters can be filled in by the 
  939. user each time the macro is expanded. For example, assume that the above 
  940. macro should permit the author to determine what word is moved across the 
  941. screen. The file ANIMATE.PIM could be modified as follows: 
  942.  
  943.        TS:G10,10
  944.        TS:*20(A ?a;D3;Wr)
  945.  
  946. Now, when the author calls upon the macro, EZ prompts the author for the 
  947. value to be substituted in where the symbolic parameter "?a" is found. If the 
  948. author replies "happy", then the code that is expanded into the author's text 
  949. is: 
  950.  
  951.        TS:G10,10
  952.        TS:*20(A happy;D3;Wr)
  953.  
  954. The same technique could be used for the starting position, number of steps 
  955. to take and delay time: 
  956.  
  957.        TS:G?a,?b
  958.        TS:*?c(A ?d;D?e;Wr)
  959.  
  960. Now when the author calls upon the macro, EZ prompts for five symbolic 
  961. parameters: ?a, ?b, ?c, ?d and ?e.  
  962.  
  963. One macro can use up to 20 different symbolic parameters, named ?a through 
  964. ?u. Upper and lower case letters can be used and are considered equal. When 
  965. expanding the macro into the text, EZ prompts for the string to be 
  966. substituted for each symbolic parameter on the first occurrence of the 
  967. parameter. Then the string is substituted for all occurrences of the symbolic 
  968. parameter within the macro.  
  969.  
  970. ?SET COMMAND
  971.  
  972. A macro can also set the value of a symbolic parameter directly by inclusion 
  973. of a ?SET command line. The ?SET command line is not ever present in the 
  974. resultant expanded text. The function of the ?SET command is only to set the 
  975. value of a symbolic parameter. The format of the ?SET command is as follows: 
  976.  
  977.        ?SET a=value
  978.  
  979. "a" represents one of the symbolic parameters,"a" through "u". The value 
  980. string is assigned to the symbolic parameters.  
  981.  
  982. LABEL SYMBOLIC PARAMETER
  983.  
  984. There is one special symbolic parameter, signified by four question marks, as 
  985. shown in this example: 
  986.  
  987.        *A???? T:#N
  988.        C:N=N+1
  989.        J(N<10):A????
  990.  
  991. EZ substitutes a unique four digit number for the ????. It is unique in that 
  992. prior to expanding the macro, that number is not present anywhere in the 
  993. text. Once the four digit number is selected, it is substituted for each 
  994. occurrence of the ???? in this expansion of the macro. If the same macro is 
  995. expanded again, then a new four-digit number is used. In this way a macro can 
  996. contain labels which are guaranteed to be unique for each occurrence of the 
  997. macro.  
  998.  
  999. ?REM COMMAND
  1000.  
  1001. It is possible to insert remarks or instructions to the user within a macro 
  1002. using the "?REM" command. For example: 
  1003.  
  1004.        TS:G10,10
  1005.        ?REM Enter the word to animate.
  1006.        TS:*20(A ?a;D2;WR)
  1007.  
  1008. In the above case, the user would see the message "Enter the word to 
  1009. animate." just prior to the prompt for the symbolic parameter "?a". This 
  1010. could be used to inform the user of the macro as to the expected values to be 
  1011. filled in. The ?REM line is not included in the macro output.  
  1012.  
  1013. CONDITIONAL MACRO EXPANSION
  1014.  
  1015. There are several macro commands which can be inserted in a macro to control 
  1016. how it is expanded. It is possible to conditionally include or skip sections 
  1017. of code via the setting of the "expand flag". When the expand flag is on then 
  1018. text lines are included in the result, when the expand flag is off then text 
  1019. lines are skipped. The macro commands which can affect the setting of the 
  1020. expand flag are shown below. Each command must start at the beginning of a 
  1021. line. The keyword may be upper or lower case. The command line itself is not 
  1022. placed in the resultant expanded code.  
  1023.  
  1024. The conditional macro statements are show below.  
  1025.  
  1026. ?ON
  1027.  
  1028. turn on the expand flag
  1029.  
  1030. ?OFF
  1031.  
  1032. turn off the expand flag
  1033.  
  1034. ?ELSE
  1035.  
  1036. invert the setting of the expand flag
  1037.  
  1038. ?ASK question text
  1039.  
  1040. The question text is presented to the user. If the user responds by pushing 
  1041. the "Y" key then the expand flag is turned on. Otherwise it is turned off.  
  1042.  
  1043. ?IF a=value
  1044.  
  1045. "a" represents one of the symbolic parameters, "a" through "u". If the 
  1046. symbolic parameter matches the value string, then the expand flag is turned 
  1047. on. Otherwise it is turned off.  
  1048.  
  1049.  
  1050.